namespace C4F.DevKit.Bluetooth.ObjectExchange
{
    #region Using Directives
    using System;
    #endregion

    /// <summary>
    /// Represents the Security Model to be used by an ObjectExchangeItem.
    /// </summary>
    public class ObjectExchangeSecurity
    {
        #region Private Fields

        /// <summary>
        /// Authenticate Challenge details to be used while adding an 
        /// Authentication Challenge header to an ObjectExchange Packet.
        /// </summary>
        private IAuthenticateChallenge challengeData;

        /// <summary>
        /// Authenticate Response details to be used while adding an 
        /// Authentication Response header to an ObjectExchange Packet.
        /// </summary>
        private IAuthenticateResponse responseData;

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets the data to be sent in the Authenticate Challenge Header of an
        /// ObjectExchange Packet.
        /// </summary>
        public IAuthenticateChallenge ChallengeData
        {
            get { return this.challengeData; }
        }

        /// <summary>
        /// Gets the data to be sent in the Authenticate Response Header of an
        /// ObjectExchange Packet.
        /// </summary>
        public IAuthenticateResponse ResponseData
        {
            get { return this.responseData; }
        }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of ObjectExchangeSecurity with the 
        /// ChallengeData property set.
        /// </summary>
        /// <param name="challengeData">AuthenticateChallenge object containing
        /// data required to form an Authentication Challenge header in an 
        /// ObjectExchange Packet.</param>
        /// <exception cref="ArgumentNullException">challengeData is passed as
        /// a null reference.</exception>
        public ObjectExchangeSecurity(IAuthenticateChallenge challengeData)
        {
            if (challengeData == null)
                throw new ArgumentNullException("challengeData");

            this.challengeData = challengeData;
        }

        /// <summary>
        /// Initializes a new instance of ObjectExchangeSecurity with the 
        /// ResponseData property set.
        /// </summary>
        /// <param name="responseData">AuthenticateResponse object containing
        /// data required to form an Authentication Response header in an
        /// ObjectExchange Packet.</param>
        /// <exception cref="ArgumentNullException">responseData is passed as
        /// a null reference.</exception>
        public ObjectExchangeSecurity(IAuthenticateResponse responseData)
        {
            if (responseData == null)
                throw new ArgumentNullException("responseData");

            this.responseData = responseData;
        }

        #endregion
    }
}